package edu.ahut.designpattern.chainresponsibility.app;

import org.junit.Test;

import java.util.Scanner;

public class Application {
    FactorialHandler[] handlers = new FactorialHandler[]{
            new IntegerFactorialHandler(),
            new LongFactorialHandler(),
            new BigIntegerFactorialHandler()
    };

    void setupChains() {
        for (int i = 0; i < handlers.length - 1; i++) {
            handlers[i].setNextHandler(handlers[i + 1]);
        }
    }


    @Test
    public void main(){
        setupChains();
//        Scanner cin = new Scanner(System.in);
        int n =55;
        handlers[0].handleRequest(n);
//        cin.close();

    }
}
/**
 * 1. 可扩展性
 * 2 1-12 Integer
 * 3 13-20 Long
 * 4 n>20 BigInteger
 * <p>
 * 1. FactorialHandler  <= IntegerXXX  LongHandler  BigIntegerHandler
 * 2. 构建一个处理机的链条chain
 * <p>
 * 1. FactorialHandler  <= IntegerXXX  LongHandler  BigIntegerHandler
 * 2. 构建一个处理机的链条chain
 * <p>
 * 1. FactorialHandler  <= IntegerXXX  LongHandler  BigIntegerHandler
 * 2. 构建一个处理机的链条chain
 */

/**
 * 1. FactorialHandler  <= IntegerXXX  LongHandler  BigIntegerHandler
 * 2. 构建一个处理机的链条chain
 */